<%@ Control Language="C#" ClassName="ContractHolders" Inherits="Dimok.Web.UI.TableControl" %>

<script runat="server">
</script>

<table>
<tr><td>
<ajaxtk:CollapsiblePanelExtender runat="server"
	TargetControlID="pnlCBT"
	CollapseControlID="pnlCBTHeader" ExpandControlID="pnlCBTHeader"
	TextLabelID="lblCBTLabel"
	ImageControlID="imgCBTPanel"
	CollapsedImage="~/images/Buttons/expand.jpg" ExpandedImage="~/images/Buttons/collapse.jpg"
	Collapsed="true"	CollapsedText="" ExpandedText=""
	SuppressPostBack="true"
></ajaxtk:CollapsiblePanelExtender>
<asp:Panel ID="pnlCBTHeader" CssClass="PanelHeaderBlue" style="width:100%" runat="server">
<table cellPadding="0" cellSpacing="0"><tr>
<th Width="1px"><asp:Image ID="imgCBTPanel" ImageUrl="~/images/Buttons/expand.jpg" runat="server" />
<td nowrap><label ID="lblCBTLabel" runat="server">Contract Holders List</label></td>
</tr></table>
</asp:Panel> 
<asp:Panel ID="pnlCBT" runat="server" CssClass="PannelContent">

<asp:UpdatePanel ID="up" UpdateMode="Always" runat="server">
	<ContentTemplate>
		<UI:GridViewEx ID="grv" runat="server" AutoGenerateColumns="False" DataSourceID="ds"
			ShowFooter="True" AllowSorting="True" EnableViewState="false"
			DataKeyNames="ID"
			>
			<Columns>

		<asp:TemplateField HeaderText="Code" SortExpression="ConditionsCode">
			<ItemTemplate><%#Eval("ConditionsCode")%></ItemTemplate>
			<EditItemTemplate><asp:DropDownList ID="selConditionsCode" SelectedValue='<%#Bind("ConditionsCode")%>' DataTextField="Code" DataValueField="Code" DataSourceID="dsContractConditions" runat="server" /></EditItemTemplate>
			<FooterTemplate><asp:DropDownList ID="ConditionsCode" DataTextField="Code" DataValueField="Code" DataSourceID="dsContractConditions" runat="server" /></FooterTemplate>
		</asp:TemplateField>

		<asp:TemplateField HeaderText="Full Name" SortExpression="Name">
			<ItemTemplate><%#Eval("Name")%></ItemTemplate>
			<EditItemTemplate><asp:TextBox ID="txtName" Text='<%#Bind("Name")%>' runat="server" /></EditItemTemplate>
			<FooterTemplate><asp:TextBox ID="Name" runat="server" /></FooterTemplate>
		</asp:TemplateField>

		<asp:TemplateField HeaderText="Short Name" SortExpression="Nick">
			<ItemTemplate><%#Eval("Nick")%></ItemTemplate>
			<EditItemTemplate><asp:TextBox ID="txtNick" Text='<%#Bind("Nick")%>' runat="server" /></EditItemTemplate>
			<FooterTemplate><asp:TextBox ID="Nick" runat="server" /></FooterTemplate>
		</asp:TemplateField>

		<asp:TemplateField HeaderText="Dealer" SortExpression="DealerName">
			<ItemTemplate><%#Eval("DealerName")%></ItemTemplate>
			<EditItemTemplate><asp:DropDownList SelectedValue='<%# Bind("DealerID") %>'  ID="selDealerID" DataSourceID="dsDealers" DataTextField="ShortName" DataValueField="ID" runat="server" /></EditItemTemplate>
			<FooterTemplate><asp:DropDownList ID="DealerID" DataSourceID="dsDealers" DataTextField="ShortName" DataValueField="ID" runat="server" /></FooterTemplate>
		</asp:TemplateField>

		<asp:TemplateField HeaderText="Contact Name" SortExpression="ContactName">
			<ItemTemplate><%#Eval("ContactName")%></ItemTemplate>
			<EditItemTemplate><asp:TextBox ID="txtContactName" Text='<%#Bind("ContactName")%>' runat="server" /></EditItemTemplate>
			<FooterTemplate><asp:TextBox ID="ContactName" runat="server" /></FooterTemplate>
		</asp:TemplateField>

		<asp:TemplateField HeaderText="Contact Phone" SortExpression="ContactPhone">
			<ItemTemplate><%#Eval("ContactPhone")%></ItemTemplate>
			<EditItemTemplate><asp:TextBox ID="txtContactPhone" Text='<%#Bind("ContactPhone")%>' runat="server" /></EditItemTemplate>
			<FooterTemplate><asp:TextBox ID="ContactPhone" runat="server" /></FooterTemplate>
		</asp:TemplateField>

		<asp:TemplateField HeaderText="Contact Fax" SortExpression="ContactFax">
			<ItemTemplate><%#Eval("ContactFax")%></ItemTemplate>
			<EditItemTemplate><asp:TextBox ID="txtContactFax" Text='<%#Bind("ContactFax")%>' runat="server" /></EditItemTemplate>
			<FooterTemplate><asp:TextBox ID="ContactFax" runat="server" /></FooterTemplate>
		</asp:TemplateField>

		<asp:TemplateField HeaderText="Contact Email" SortExpression="ContactEmail">
			<ItemTemplate><%#Eval("ContactEmail")%></ItemTemplate>
			<EditItemTemplate><asp:TextBox ID="txtContactEmail" Text='<%#Bind("ContactEmail")%>' runat="server" /></EditItemTemplate>
			<FooterTemplate><asp:TextBox ID="ContactEmail" runat="server" /></FooterTemplate>
		</asp:TemplateField>

		<asp:TemplateField HeaderText="Street" SortExpression="Street">
			<ItemTemplate><%#Eval("Street")%></ItemTemplate>
			<EditItemTemplate><asp:TextBox ID="txtStreet" Text='<%#Bind("Street")%>' runat="server" /></EditItemTemplate>
			<FooterTemplate><asp:TextBox ID="Street" runat="server" /></FooterTemplate>
		</asp:TemplateField>

		<asp:TemplateField HeaderText="City" SortExpression="City">
			<ItemTemplate><%#Eval("City")%></ItemTemplate>
			<EditItemTemplate><asp:TextBox ID="txtCity" Text='<%#Bind("City")%>' runat="server" /></EditItemTemplate>
			<FooterTemplate><asp:TextBox ID="City" runat="server" /></FooterTemplate>
		</asp:TemplateField>

		<asp:TemplateField HeaderText="State" SortExpression="State">
			<ItemTemplate><%#Eval("State")%></ItemTemplate>
			<EditItemTemplate><asp:TextBox ID="txtState" Text='<%#Bind("State")%>' runat="server" /></EditItemTemplate>
			<FooterTemplate><asp:TextBox ID="State" runat="server" /></FooterTemplate>
		</asp:TemplateField>

		<asp:TemplateField HeaderText="Zip" SortExpression="Zip">
			<ItemTemplate><%#Eval("Zip")%></ItemTemplate>
			<EditItemTemplate><asp:TextBox ID="txtZip" Text='<%#Bind("Zip")%>' runat="server" /></EditItemTemplate>
			<FooterTemplate><asp:TextBox ID="Zip" runat="server" /></FooterTemplate>
		</asp:TemplateField>

		<asp:TemplateField HeaderText="AgreementDate" ItemStyle-HorizontalAlign="Center" SortExpression="AgreementDate">
			<ItemTemplate><%#Eval("AgreementDate", "{0:d}")%></ItemTemplate>
			<EditItemTemplate><asp:TextBox ID="txtAgreementDate" Text='<%#Bind("AgreementDate","{0:d}")%>' runat="server" /></EditItemTemplate>
			<FooterTemplate><asp:TextBox ID="AgreementDate" runat="server" /></FooterTemplate>
		</asp:TemplateField>

			</Columns>
		</UI:GridViewEx>
	</ContentTemplate>
</asp:UpdatePanel>

</asp:Panel>
</table>
<DS:ContractHoldersDataSource ID="ds" runat="server" />
<DS:DealersDataSource ID="dsDealers" runat="server" />
<DS:ContractConditionsDataSource ID="dsContractConditions" FilterDefault="Code>'  '" runat="server" />
